package com.bsoft.gol.hcs.clinical.dao;


import com.bsoft.gol.hcs.clinical.bean.req.QueryMedicalSkillListReq;
import com.bsoft.gol.hcs.clinical.entity.HoConsultAsk;
import ctd.persistence.annotation.DAOMethod;
import ctd.persistence.annotation.DAOParam;
import ctd.persistence.support.hibernate.HibernateSupportDelegateDAO;


import java.util.List;

public abstract class ConsultAskDAO extends HibernateSupportDelegateDAO<HoConsultAsk> {

    @DAOMethod(sql = "from HoConsultAsk where orgId=:orgId and  visitNo=:visitNo ")
    public abstract List<HoConsultAsk> queryConsultAsksByVisitNo(@DAOParam("orgId") String orgId, @DAOParam("visitNo") String visitNo);

    @DAOMethod(sql = " from HoConsultAsk where consultId =:consultId ")
    public abstract HoConsultAsk getConsultAskTool(@DAOParam("consultId") Long consultId);

    /**
     * @Description: 调用互联网医院接口
     * @Author: zhaorb
     * @Date: 2020/6/18 13:57
     *
     * @return*/
    public HoConsultAsk getConsultAsk(String consultId) {
        return getConsultAskTool(Long.parseLong(consultId));
    }

    @DAOMethod(sql = " from HoConsultAsk where hospitalCode =:hospitalCode  and emergencyNumber =:emergencyNumber ")
    public abstract HoConsultAsk getConsultAskByEmergencyNumber(@DAOParam("hospitalCode") String hospitalCode,@DAOParam("emergencyNumber") String emergencyNumber);

    public HoConsultAsk getConsultAskAll(QueryMedicalSkillListReq request) {
        String consultId = request.getConsultId();
        return getConsultAskTool(Long.parseLong(consultId));
    }

    /**
     * @Description: 更新线下就诊序号
     * @Author: zhaorb
     * @Date: 2020/6/19 16:39
     **/
    @DAOMethod(sql = " update HoConsultAsk set emergencyNumber = :emergencyNumber where consultId =:consultId ")
    public abstract void updateEmergencyNumberTool(@DAOParam("consultId")Long consultId, @DAOParam("emergencyNumber")String emergencyNumber);

    public void updateEmergencyNumber(String consultId,String emergencyNumber) {
         updateEmergencyNumberTool(Long.parseLong(consultId),emergencyNumber);
    }

}
